package com.kgame5.xtank3d.effect.myemitters {
import kgame5.k3d.core.obj3d.node3d.Node3D;
import kgame5.k3d.pars.myflint.geom.Vector3DFlint;
import kgame5.k3d.pars.myflint.zones.BoxZone;
import kgame5.k3d.pars.myflint.zones.Zone3D;
import kgame5.kmath.MathDG;

import com.kgame5.xtank3d.effect.MyEmitter;
import com.kgame5.xtank3d.resource.ResourceManagerX;

/**
 * @author kk
 */
public class VerticalBlastEmitter extends MyEmitter{
	//xyz是爆炸原点
	public function VerticalBlastEmitter(R:int) {
		//碎片产生的区域
		var pZone:Zone3D=new BoxZone(R, R, R, 
										new Vector3DFlint(0, 0, 0),
										Vector3DFlint.AXISY, 
										Vector3DFlint.AXISZ);
		//T.p(A,B,H);
		var count:int=MathDG.random(6,8);
		for(var i:int=0;i<count;i++){

			var vy:Number=MathDG.random(13, 35);
			//trace(i,size,m,vy);
			
			var md_chip:Node3D=ResourceManagerX.getInstance().getBlastVertical();
//				
			
			var r:Number=MathDG.random(0,360);
			var rv:Number=MathDG.random(2,4)*5;
			
			var life:Number=13;//(vy/-PosiM.G)*2;
				///////////////////
			
			//var alpha:Number=1;//MathDG.random(70, 100)/100;
			//var alphaSpeed:Number=0;//-MathDG.random(2, 5)/100;
			
			var scale:Number=MathDG.random(70, 100)/100;
			var scaleSpeed:Number=-MathDG.random(2, 5)/100;
			//发射
			var vv:Vector3DFlint=pZone.getLocation();
			md_chip.x=vv.x;
			md_chip.y=vv.y;
			md_chip.z=vv.z;
			
			md_chip.vy=vy;
			md_chip.ti.hardVO.v3d_a.y=-2;//SpacialManager.G;
			
			md_chip.rotY=r;
			md_chip.ti.hardVO.v3d_rv.y=rv;
			
			md_chip.scale3 = scale;
			md_chip.ti.hardVO.v3d_sv.fill(scaleSpeed, scaleSpeed, scaleSpeed);
			
			md_chip.life=life;
			
			md_g.addChild(md_chip);
		}
//				
//		//==counter
//		counter = new Blast(MathDG.random(5, 7));
//		
//		//==Initializer
//		
//		addInitializer(new PV3DObjectClass(Sprite3DX,"MyMc_Blast"));//必须有个皮肤，这个很重要
//
//		addInitializer(new Position(new CylinderZone(new Vector3D(x, 0, z),new Vector3D(0, 1, 0),70,20)));
//			
//		addInitializer(new Velocity(new LineZone(new Vector3D(0, C.FR*2, 0), new Vector3D(0, C.FR*20, 0))));
//		
//		addInitializer(new Rotation(new Vector3D(0,0,1),0,360));
//		
//		addInitializer(new Lifetime(2));
//		
//		//addInitializer(new ColorInit(0xffffffff,0xff333333));
//
//		//addInitializer(new ApplyMaterial(ColorMaterial, 0xff0000));
//		
//		//==Action
//		//addAction(new BoundingBox(-1000,1000,0,1000,-1000,1000,0.01));
//		addAction(new Age());
//		addAction(new Move());
//		//addAction(new Fade(1,0));
////		//addAction(new Accelerate(new Vector3D(0,-60*20,0)));
////		addAction(new DeathSpeed(5*20,true));
////		//addAction(new ScaleAll(0.2,0.02));
//		addAction(new RandomDrift(400, 0, 400));
//		//addAction(new Explosion(10,new Vector3D(0,0,0),100*20,32));
//		addAction(new LinearDrag(0.9));
	}
}
}
